package com.heima.wemedia.controller.v1;

import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.SensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController {
    @Autowired private SensitiveService sensitiveService;

    //删除敏感词
    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable("id") Integer id){
        return sensitiveService.sensitiveDelete(id);
    }

    //修改敏感词
    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmSensitive wmSensitive){
        return sensitiveService.sensitiveUpdate(wmSensitive);
    }

    //查询敏感词
    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto dto){
        return sensitiveService.sensitiveList(dto);
    }

    //新增敏感词
    @PostMapping("/save")
    public ResponseResult save(@RequestBody WmSensitive wmSensitive){
        return sensitiveService.sensitiveSave(wmSensitive);
    }}
